#ifndef __APP_SERIAL_H__
#define __APP_SERIAL_H__

#include <termios.h>
#include "app_device.h"

typedef enum
{
    BR_9600 = B9600,
    BR_115200 = B115200,
}BraudRate;

//校验位
typedef enum
{
    Parity_NONE = 0,
    Parity_ODD = PARENB|PARODD,
    Parity_EVEN = PARENB,
}Parity;

//停止位
typedef enum
{
    StopBits_1 = 0,
    StopBits_2 = CSTOPB,
}StopBits;

int app_serial_init(device_t *device);
/**
 * 设置波特率
 */
int app_serial_setBraudRate(device_t *device, BraudRate rate);

/**
 * 设置校验位
 */
int app_serial_setParity(device_t *device, Parity parity);

/**
 * 设置停止位
 */
int app_serial_setStopBits(device_t *device, StopBits stopBits);

/**
 * 设置是否阻塞模式
 */
int app_serial_setBlock(device_t *device, int is_block);

/**
 * 设置为原始模式
 */
int app_serial_setRaw(device_t *device);



#endif /* __APP_SERIAL_H__ */
